package com.tom.demo;

public class Test326_PowerOfThree {

    public boolean isPowerOfThree(int n) {
        if (n <= 0) {
            return false;
        }
        while (n % 3 == 0) {
            n /= 3;
        }
        return n == 1;
    }
    public boolean isPowerOfThree2(int n) {
        return n > 0 && 1162261467 % n == 0;
    }

    public static void main(String[] args) {
        int n = 28;
        n= n >> 3;
        System.out.println(n);
        n= n >> 3;
        System.out.println(n);
        n= n >> 3;
        System.out.println(n);
    }
}
